package com.gdk.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.gson.Gson;
import com.gdk.service.ArticleService;
import com.gdk.service.BannerService;
import com.gdk.service.GoodsService;
import com.gdk.service.LoginService;
import com.gdk.service.NavigationService;
import com.gdk.service.SetService;
import com.gdk.service.TreeService;
import com.gdk.utils.XVDateUtils;


/**
 * 设置controller
 * */

@Controller
public class SetController {
	
	@Autowired
    private SetService setService;
	
	/**
	 *修改前查询设置详情
	 * */
	@RequestMapping("/preSelectSetDetails.do")
	public String preSelectSetDetails(@RequestParam Map<String,Object> map, HttpServletRequest request) {
		
		Map<String, Object> setDetails = setService.selectSetDetails(map);
		
		
			/*if(treeDetails.get("ft_endtime") != null) {
				int p = Integer.valueOf(treeDetails.get("ft_endtime").toString());
				if(p != 0) {
					treeDetails.put("ft_endtime", XVDateUtils.MillisFormat(p));	
				}
			}
			*/
		
		request.setAttribute("setDetails",setDetails);
		return "jsp/setting/setting-edit";
	}
	
	/**
	 * 修改设置
	 * */
	@ResponseBody
	@RequestMapping("/updateSet.do")
	public int updateSet(@RequestParam Map<String,Object> map, HttpServletRequest request) {
		int set = setService.updateSetDetails(map);
		return set;
	}


}